package com.bhoethang.rabbit.listener;


import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * @author EDZ
 */
@Component
@RabbitListener(queues = "lock_merchant_dead_queue")
public class RabbitMessageListener {

    /**
     * RabbitHandler 会自动匹配 消息类型（消息自动确认）
     * @param msg
     * @param message
     * @throws IOException
     */
   @RabbitHandler
    public void messageListener(String msg, Message message, Channel channel) throws IOException, InterruptedException {


        System.out.println("监听到消息：消息内容:"+msg);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
    // this is an application about Online booking hospital appointment,  there are lot of hospital on the platform and where patients can book there  appointment from online and including
    // payment of appointment fee, hospitals can also register there hospital to the platform.
}
